package com.jy.wms.controller;

import com.github.pagehelper.Page;
import com.jy.wms.common.UUIDUtils;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.JsonResult;
import com.jy.wms.common.base.ResultPage;
import com.jy.wms.pojo.WmsTurnoverBoxChage;
import com.jy.wms.service.WmsTurnoverBoxChageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @ClassName: WmsTurnoverBoxChageController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author yjs
 * @Date Wed Oct 11 17:38:12 GMT+08:00 2017
 */
@RestController
@RequestMapping("/wmsturnoverboxchage")
@Api(value = "/wmsturnoverboxchage", description = "")
public class  WmsTurnoverBoxChageController extends BaseController<WmsTurnoverBoxChageService,WmsTurnoverBoxChage> {

    @PostMapping(value = {"list", ""})
    @ApiOperation(value = "查询信息",response = JSONObject.class, notes = "查询信息")
    public @ResponseBody
    ResultPage<WmsTurnoverBoxChage> getWmsTurnoverBoxChage(@RequestBody WmsTurnoverBoxChage entity, HttpSession session) {
        Page<WmsTurnoverBoxChage> list= baseService.baseSelectPage(entity);
            return renderPage(list);
    }

    @PostMapping(value = "delete")
    @ApiOperation(value = "删除信息",response = JSONObject.class, notes = "删除信息")
    public @ResponseBody
    JsonResult deleteWmsTurnoverBoxChage(@RequestBody List<String> ids) {
        Integer flag=baseService.baseDeleteBathPrimaryKeys(ids);
        return renderSuccess("删除成功");
    }

    @PostMapping(value = "add")
    @ApiOperation(value = "新增信息",response = JSONObject.class, notes = "新增信息")
    public @ResponseBody
    JsonResult addWmsTurnoverBoxChage(@RequestBody WmsTurnoverBoxChage entity) {
        entity.setId(UUIDUtils.uuid());
        baseService.baseInsert(entity);
        return renderSuccess("添加成功");
    }

    @GetMapping(value = "getWmsTurnoverBoxChage/{id}")
    @ApiOperation(value = "查看单个信息",response = JSONObject.class, notes = "GET查看单个信息")
    public @ResponseBody
    WmsTurnoverBoxChage getWmsTurnoverBoxChageById(@PathVariable("id") String id) {
        WmsTurnoverBoxChage entity=baseService.baseSelectByPrimaryKey(id);
        return entity;
    }
    @PostMapping(value = "edit")
    @ApiOperation(value = "编辑信息",response = JSONObject.class, notes = "编辑信息")
    public @ResponseBody
    JsonResult editWmsTurnoverBoxChage(@RequestBody WmsTurnoverBoxChage entity) {
        Integer flag=baseService.baseUpdateByPrimaryKeySelective(entity);
        return renderSuccess("修改成功");
    }
}
